<template>
   <div class="jsPromise">
      <h3>jsPromise练习</h3>
   </div>
</template>
<script>
   export default {
       data () {
           return{
               number:"下班",
           }
       },
       created (){
           this.promiseDemo();
       },
       methods:{
          promiseDemo () {
              return new Promise( (resolve,reject) => {
                  if(this.number=="下班"){
                      console.log("下班")
                      resolve(this.eater)
                  }
              }).then( (fn) => {
                  fn();
                  return this.studen();
              },function(error){
                 console.log("错误:......"+errer)
              }).then((fn) => {
                   fn
              })
          },
          eater () {
              let newDate=new Date();
              console.log(newDate.getFullYear());
              console.log(newDate.getMonth()+1)
              console.log(newDate.getDate());
              console.log(newDate.getHours());
              console.log(newDate.getMinutes());
              console.log(newDate.getSeconds());
              console.log(newDate.toLocaleDateString());
              console.log(newDate.toLocaleString())

          },
           studen () {
              console.log("学习.............")
          }
       }
   }
</script>
<style></style>